package com.shu.juc;

import java.util.concurrent.atomic.LongAccumulator;
import java.util.concurrent.atomic.LongAdder;

/**
 * @author ssm
 * @version V1.0
 * @description:
 * @date 2020/7/30 9:10
 */

public class LongAccumulatorTest {


    public static void main(String[] args) {

        LongAccumulator adder = new LongAccumulator(
                (x, y) -> x + y, 0
        );

        LongAccumulator min = new LongAccumulator(
                (x, y) -> Math.min(x,y), 7
        );

        adder.accumulate(5);

        System.out.println(adder.get());

        min.accumulate(2);
        System.out.println(min.get());

        System.out.println(System.identityHashCode(adder));
        System.out.println(System.identityHashCode(min));

        LongAdder longAdder = new LongAdder();
    }
}
